// 云函数入口文件
const cloud = require('wx-server-sdk');
cloud.init({
  // env: cloud.DYNAMIC_CURRENT_ENV,
  env:'wccloud-fm7zt',
  traceUser:true
});
const db = cloud.database();
const wxContext = cloud.getWXContext();
// 云函数入口函数
exports.main = async (event, context) => {
  let fileid = event.pics;
  const dbresult = await db.collection("news").doc(event.docid).remove();
  const delfile = await cloud.deleteFile({
    fileList: fileid,
  })
  return {
    delfile,
    dbresult,
    event,
    openid: wxContext.OPENID,
    appid: wxContext.APPID,
    unionid: wxContext.UNIONID,
  }
}